{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "collapsed": true,
        "pycharm": {
          "is_executing": false
        }
      },
      "outputs": [],
      "source": "import numpy as np\nimport pandas as pd\n\n"
    },
    {
      "cell_type": "markdown",
      "source": "老师，我打比赛遇到一个方法，对句子按长度排序，再分batch，再取batch里最长的\n\n我也是，copy别人的代码。里面只对当前batch里面取最大值。不同Batch maxlen长度可以不一样，同一个Batch一样即可 \n\n开始就加标志会影响其他词向量的结果\n\n为什么不直接删除",
      "metadata": {
        "pycharm": {
          "metadata": false
        }
      }
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "outputs": [],
      "source": "",
      "metadata": {
        "pycharm": {
          "metadata": false,
          "name": "#%%\n"
        }
      }
    },
    {
      "cell_type": "code",
      "execution_count": 13,
      "outputs": [],
      "source": "df \u003d pd.read_csv(\u0027data/proc_text.txt\u0027, header\u003dNone)",
      "metadata": {
        "pycharm": {
          "metadata": false,
          "name": "#%%\n",
          "is_executing": false
        }
      }
    },
    {
      "cell_type": "code",
      "execution_count": 22,
      "outputs": [],
      "source": "fre \u003d df[0].apply(lambda x: len(x.split(\" \")))\n",
      "metadata": {
        "pycharm": {
          "metadata": false,
          "name": "#%%\n",
          "is_executing": false
        }
      }
    },
    {
      "cell_type": "code",
      "execution_count": 29,
      "outputs": [
        {
          "data": {
            "text/plain": "\u003cFigure size 432x288 with 1 Axes\u003e",
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAD8CAYAAACcjGjIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAEMVJREFUeJzt3X+sX3V9x/Hna1RUMFqQQrBluxgbFU0c7AarLsaAgfIjlj9kY3GjIyxNFjbRuLhiljRTSSAxomaThABajOFHkIxGmKQBjFsykFtYVKiEBh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mf8d1C3Bhu2tpDfDC3uGnYS2pD8ElOZvBX5R7H9Fx+Yi7NO+S/CnwH8D3+d34+6cYXHe4BfhDBv/Jzq+qfS96HfKSfAD4h6o6N8mbGZxJHA08BPxlVf1ylP2bT0n+mMEF+MOBx4GLGPzBt2iPc5J/Bv6cwV15DwF/w2CMfdEc5yQ3Ah9g8MTZZ4FNwL8xw3FtIfkvDO5uehG4qKom5qUfSykcJEmzs5SGlSRJs2Q4SJI6hoMkqWM4SJI6hoMkqWM4SJI6hoMkqWM4SJI6/wdnrcr+a8iuawAAAABJRU5ErkJggg\u003d\u003d\n"
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": "import matplotlib.pyplot as plt\n\nplt.hist(fre, range\u003d(0,100))\nplt.show()",
      "metadata": {
        "pycharm": {
          "metadata": false,
          "name": "#%%\n",
          "is_executing": false
        }
      }
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "outputs": [],
      "source": "\n",
      "metadata": {
        "pycharm": {
          "metadata": false,
          "name": "#%%\n"
        }
      }
    }
  ],
  "metadata": {
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 2
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython2",
      "version": "2.7.6"
    },
    "kernelspec": {
      "name": "python3",
      "language": "python",
      "display_name": "Python 3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}